import os

import yaml

# 获取当前脚本所在目录
current_dir = os.path.abspath(os.path.dirname(__file__))

# 拼接出配置文件的绝对路径
settings_file_path = os.path.join(current_dir, "settings.yaml")

# 加载配置文件
with open(settings_file_path, "r") as f:
    config = yaml.safe_load(f)

# 确保这些键存在
USERS = config.get("users")
SPAWN_RATE = config.get("spawn_rate")
RUN_TIME = config.get("run_time")
BASE_URL = config.get("base_url")

# 检查是否存在 'auth' 和 'headers' 键
auth = config.get("auth", {})
AUTH_HEADERS = auth.get("headers", {})  # 获取 headers，如果不存在则返回空字典

# 可选：打印出来检查加载的内容
print("Config:", config)
print("Auth Headers:", AUTH_HEADERS)
